800734 ランダム
 HOME | DIARY | PROFILE 【フォローする】 【ログイン】

☆エコ・RDB 〔5〕レコード番号の取得_SUB

Sub Src_Rn_ER2(RDB As Worksheet, InsRn As Variant, Rn As Long, Cn As Long, Co As Long, RCpo As Integer, Cl As Variant)
'
' Get_Rn Macro
' マクロ作成日 : 2008/10/8  ユーザー名 : 寺田屋の龍馬
'
'  RDBシートの空きレコード番号を取得〔SUB〕

'  Eco_RDB【エコ・RDB】 Ver.2.0

    Dim ScPt As Variant

    If Rn = RCpo Then
        Rn = 1: Cn = Cn + 1
        If Cn = 201 Then Cn = 1
    Else
        Rn = Rn + 1
    End If

    If RDB.Cells(Rn, Cn) = Cl Then
        Co = Co + 1
    Else
        If Rn = RCpo Then
            Rn = 1: Cn = Cn + 1
            If Cn = 201 Then Cn = 1
        Else
            Rn = Rn + 1
        End If
        If RDB.Cells(Rn, Cn) = Cl Then
            Co = Co + 1
        Else
            Rn = 0: Cn = 0
            On Error GoTo ERR
            ScPt = RDB.Range("A1:GR" + CStr(RCpo)).Find(Cl, RDB.Range(RDB.Cells(5, 202)), _
                SearchOrder:=xlByColumns).Address(RowAbsolute:=False)
                Call Worksheet_SelectionChange(RDB.Range(ScPt), Rn, Cn)
            RDB.Cells(5, 202) = ScPt
            Co = Co + 1
ERR:
        End If
    End If
    InsRn = Cn * 10000 + Rn

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range, Rn As Long, Cn As Long)

    Rn = Target.Row

    Cn = Target.Column

End Sub



© Rakuten Group, Inc.
X